#----------------------------------------------------------------------
#
#  Copyright 2009, Thomas Dejanovic.
#
#  This is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as
#  published by the Free Software Foundation; either version 2.1 of
#  the License, or (at your option) any later version.
#
#  This software is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this software; if not, write to the Free
#  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
#  02110-1301 USA, or see the FSF site: http://www.fsf.org.
#
#----------------------------------------------------------------------
#
# This is a very simple sanity test for the Digilent S3 board.
#
#----------------------------------------------------------------------

# we want to hatch a register block.
hatchBlock = Struct(name='lpcb', target='small lpcb slave', address=5)

hatchBlock.Register('button', bit_width=4, sw='r', external=True,
                    comment="""This is the bank of 4 buttons on the bottom left edge of the board.""")

hatchBlock.Register('switch', bit_width=8, sw='r', external=True,
                    comment="""This is the bank of 8 switches on the bottom right edge of the board.""")

hatchBlock.Register('led', bit_width=8, sw='rw', hw='r',
                    comment="""This is the bank of 8 LEDs on the bottom left corner of the board.""")

hatchBlock.Register('big_reg', bit_width=32, sw='rw')

cPack = hatchBlock.Pack('cPack',
                        comment="""This is the 4x 7 segment display on the bottom right corner of the board. Values are desplayed in hex.""")
cPack.Register('c3', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c2', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c1', bit_width=4,  sw='rw', hw='ir')
cPack.Register('c0', bit_width=4,  sw='rw', hw='ir')


hatchBlock.Register('fifo_addr', bit_width=8, sw='rw', hw='r',
                    auto_inc_on="fifo_data_sw_trigger_count==4'd1")

hatchBlock.Register('fifo_data', bit_width=32, sw='rwt', sw_trigger_on='rw', 
                    trigger_count=10, external=True)
